#include<bits/stdc++.h>
using namespace std;
long long a[100200],b[100200],c[100200],d[5],n,m;
int main()
{
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	cin>>n;m=n-1;
	for(int i=1;i<=n;i++)
	{
		cin>>d[1]>>d[2]>>d[3];
		a[i]=max(b[i-1],c[i-1])+d[1];
		b[i]=max(a[i-1],c[i-1])+d[2];
		c[i]=max(b[i-1],a[i-1])+d[3];
	}
	cout<<max(a[n],max(b[n],c[n]));
	return 0;
} 
